package com.heima.user.controller.v1;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.admin.dtos.LoginResponseDTO;
import com.heima.model.user.dtos.AppLoginDto;
import com.heima.model.user.dtos.UserInfoDto;
import com.heima.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Fuqiang
 * @since :2023-03-28
 */
@RestController
@RequestMapping("/api/v1/login")
public class UserLoginController {

    @Autowired
    ApUserService userService;

    /**
     * App用户登录 允许匿名登陆
     *
     * @param dto
     * @return
     */
    @PostMapping("/login_auth")
    public ResponseResult<LoginResponseDTO<UserInfoDto>> login(@Validated @RequestBody AppLoginDto dto) {

        return userService.login(dto);
    }

}
